﻿/*
 * RegExpress
 * 
 * Copyright (c) 2010, Daniel McGaughran
 * 
 * Licensed under the Apache Licence, Version 2.0 (the "Licence");
 * you may not use this file except in compliance with the Licence.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the Licence is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the Licence for the specific language governing permissions and
 * limitations under the Licence.
 * 
 */

using System;
using System.Collections.Generic;


namespace RegExpressModel.Entities
{
	public class SlideDeck
	{
		private Dictionary<string, Slide> _slides;


		public SlideDeck()
		{
			_slides = new Dictionary<string, Slide>();
			FirstSlide = null;
		}


		public bool AddSlide(Slide newSlide)
		{
			if (newSlide == null || String.IsNullOrEmpty(newSlide.ID) || _slides.ContainsKey(newSlide.ID))
				return false;

			_slides.Add(newSlide.ID, newSlide);

			if (FirstSlide == null)
				FirstSlide = newSlide;

			return true;
		}


		public Slide this[string slideID]
		{
			get
			{
				if (_slides.ContainsKey(slideID))
					return _slides[slideID];

				return null;
			}
		}


		public bool HasSlide(string slideID)
		{
			return _slides.ContainsKey(slideID);
		}


		public Slide FirstSlide { get; private set; }


	}
}
